﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Globalization;
using System.Linq;
using System.Windows;

namespace TM.PowerPointController.Server
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            LoadLanguage();
        }

        /// <summary>
        /// 加载语言
        /// </summary>
        private void LoadLanguage()
        {
            var cultureInfo = CultureInfo.CurrentCulture;
            var lang = Application.LoadComponent(new Uri(@"Language\" + cultureInfo.Name + ".xaml", UriKind.Relative)) as ResourceDictionary;
            if (lang != null)
            {
                //if(this.Resources.MergedDictionaries.Count>0)
                //{
                //    this.Resources.MergedDictionaries.Clear();
                //}
                this.Resources.MergedDictionaries.Add(lang);
            }
        }
    }
}
